package com.jpaAutoProcess.utils.type;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @User: c.c
 * @Date: 2022/6/8
 * @Time: 9:13
 * @Description: 数据类型判断
 */

public class Classtype {

    static public PropertyType  judgeClassProperty(Object o){
        if (o instanceof String){
            return  PropertyType.String;
        }
        if (o instanceof Integer){
            return PropertyType.Integer;
        }
        if (o instanceof Boolean){
            return PropertyType.Boolean;
        }
        if (o instanceof  Long){
            return PropertyType.Long;
        }
        if (o instanceof LocalDateTime){
            return PropertyType.LocalDateTime;
        }
        if (o instanceof BigDecimal){
            return PropertyType.BigDecimal;
        }
        if (o instanceof BigDecimal){
            return PropertyType.BigDecimal;
        }
        if (o instanceof Date){
            return PropertyType.Date;
        }
        if (o instanceof List){
            return judgeClassProperty(((List) o).get(0));
        }
        throw new RuntimeException("没有找到基础数据类型");
    }
}
